package com.zms.maze;

import com.zms.maze.MummyConst.Direction;

//this class represents the instance of maze and direction will be applied on it.
public class Action implements Cloneable {
	private Maze maze;
	private Direction dir;
	
	public Action(Maze maze, Direction dir)
	{
		this.maze=maze;
		this.dir=dir;
	}
	public Maze getMaze()
	{
		return this.maze;
	}
	public Direction getDirection()
	{
		return this.dir;
	}
	public String getDriString()
	{
		return this.dir.name();
	}
	
	public boolean equals(Object obj) {
	    if (!(obj instanceof Action)) {
	        return false;
	    } else {
	    	Action that = (Action)obj;
	        return (this.maze.equals(that.maze) && this.dir.equals(that.dir));
	    }
	}
	public int hashCode()
	{
		return dir.hashCode();
	}
	protected Action clone() 
	{
		try
		{
        Action c=new Action(this.maze.clone(),this.dir);
        return c;
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
		return null;
	}
}
